<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Importing from existing resource files</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>

<body>

<p>ResourceBlender can import translations from existing .properties, .resx or .po files. Click <strong>Resources->Import</strong> from ResourceBlender Express or <strong>Import</strong> from the navigation menu in ResourceBlender for ASP.NET to get started.</p>

<div class="contents">
  <h2>Contents</h2>
  <ol>
    <li><a href="#properties">Importing from .properties files</a></li>
    <li><a href="#resx">Importing from .resx files</a></li>
    <li><a href="#po">Importing from .po files</a></li>
    <li><a href="#namefilter">Filtering by element name</a></li>
  </ol>
</div>

<p>Resource files to import can be specified individually or as a group. If the selection contains zip files, they will be automatically extracted before import. The only requirement before importing is that an application has been added into which the bundles can be imported. Depending on the format of the resources being imported, the filename of the file (or each file if uploading a zip archive) will be used to determine the name of the bundle and language of the resources contained within it.</p>
<p><strong>Note:</strong> All available languages from the uploaded files will be imported, but only languages which have been included with an application will be visible when editing translations or generating resources.</p>

<h2><a name="properties">Importing from .properties files</a></h2>
<p>Files are imported using the filename as the source for both the bundle name and the language. ResourceBlender expects files named <strong><span style="color:#EF0E0E;">BundleName</span>_<span style="color:#1B1675;">language-code</span>.properties</strong> and each element in the file to be represented as <strong><span style="color:#158F00;">ElementName</span>=<span style="color:#8F4000;">Translation</span></strong>.</p>
<p><strong>For example:</strong> If a zip file containing <strong><span style="color:#EF0E0E;">mybundle</span>_<span style="color:#1B1675;">en</span>.properties</strong> and <strong><span style="color:#EF0E0E;">mybundle</span>_<span style="color:#1B1675;">de</span>.properties</strong> is uploaded,  ResourceBlender will first add a bundle called <strong>mybundle</strong> to the application if it does not already exist.</p>
<p>Elements will then be loaded from the files and resources will be created from the translations in each file that was uploaded. If an element does not exist, it will be created. Otherwise, ResourceBlender will try to find an existing resource by searching for an exact match for the translation in the file's language, then use the translation in the file to update the existing resource.</p>

<h3>Scenario</h3>
<p><strong>For example:</strong> A file called <strong><span style="color:#EF0E0E;">anotherbundle</span>_<span style="color:#1B1675;">de</span>.properties</strong> containing the following lines is imported into an application.
<pre>
<span style="color:#158F00;">startapplication</span>=<span style="color:#8F4000;">Program starten</span>
<span style="color:#158F00;">quitapp</span>=<span style="color:#8F4000;">Program schliessen</span>
</pre>
<p>The German language (language code=<strong><span style="color:#1B1675;">de</span></strong>) and a bundle called <strong><span style="color:#EF0E0E;">anotherbundle</span></strong> have already been added to the application. There is an element called <strong><span style="color:#158F00;">startapplication</span></strong>, but the resource used has no German translation and there is no element called <strong><span style="color:#158F00;">exitapplication</span></strong>.</p>

<h3>Result</h3>
<p>Java files are read line by line with an equals (=) separating the element name and translation, so ResourceBlender starts with the element called <strong><span style="color:#158F00;">startapplication</span></strong>. This elemnt's resource had no German translation, so one is added. If there had already been a German translation, it would be replaced by the one in the file.</p>
<p>The next element is <strong><span style="color:#158F00;">quitapp</span></strong>. The element does not exist, so a new element is created and the German translation in the file (<strong><span style="color:#8F4000;">Program schliessen</span></strong>) is added to create a new resource.</p>
<p>If German had not been added as a language for the application, the translations would still have been added to the database, but they would not be visible when editing translations or generating resources.</p>

<h2><a name="resx">Importing from .resx files</a></h2>
<p>The filename is used as the source for both the bundle name and language of the resources in the file. ResourceBlender expects files named <strong><span style="color:#EF0E0E;">BundleName</span>.<span style="color:#1B1675;">language-code</span>.resx</strong> and the file itself to conform the .resx format specification. Ie: There must be a &lt;root&gt; node, and each element must be contained within the following format:.</p>
<pre>
&lt;data name="<span style="color:#158F00;">ElementName</span>"&gt;
&lt;value&gt;<span style="color:#8F4000;">Translation</span>&lt;/value&gt;
&lt;/data&gt;
</pre>
<p>The import process is the same as with .properties (see the scenario above), but the format of the file is different.</p>

<h2><a name="po">Importing from .po files</a></h2>
<p>The names of the PO files inside the zip are used to determine the bundle names and languages of the resources they contain. If uploading individually, a random bundle name will be generated. To upload to a specific bundle, create a folder for that bundle inside the archive. ResourceBlender expects an archived structured as whatever.zip/<strong><span style="color:#EF0E0E;">BundleName</span>/<span style="color:#1B1675;">language-code</span>.po</strong> and the file itself to conform the .po format specification.</p>
<p>For more information about the structure of .po files, see <a href="PO.Format.html">GNU PO Format</a>.</p>

<h2><a name="namefilter">Filtering by element name</a></h2>
<p>When importing .resx or .properties files, if a filter is entered, only elements containing it will be imported. This can be usefl when importing generated .resx files as they often contain meta-data such as positioning information.</p>
<p><strong>Note:</strong> Elements can only be filtered when importing from .resx or .properties.</p>

</body>
</html>

